package net.ibizsys.eclipse.studio.data;

import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @author <a href='http://www.weibo.com/xjtoo' target='_blank'>Enmaai</a>
 */
public enum ProjectType
{
	Unknown("", 0),

	PUB("PUB", 100), SRVPUB("SRV_PUB", 101), APPPUB("APP_PUB", 102), WEBPUB("WEB_PUB", 103),

	USR("USR", 1000), SRVUSR("SRV_USR", 1001), APPUSR("APP_USR", 1002), WEBUSR("WEB_USR", 1003);

	private String code;
	private int value;

	private ProjectType(String code, int value)
	{
		this.code = code;
		this.value = value;
	}

	public String code()
	{
		return this.code;
	}

	public int value()
	{
		return this.value;
	}

	private static final Map<String, ProjectType> map = new HashMap<String, ProjectType>();
	static
	{
		for (ProjectType val : values())
		{
			map.put(val.code(), val);
		}
	}

	public static ProjectType convert(String name)
	{
		if (map.containsKey(name))
		{
			return map.get(name);
		}
		return ProjectType.Unknown;
	}

}
